<?php
include("configAdmin.php");

require_once(BIB_ADODB);

require_once(FWK_CONTROL."ControlSmarty.class.php");
require_once(FWK_CONTROL."ControlSessao.class.php");
require_once(FWK_CONTROL."ControlDB.class.php");

require_once(BIB_PEARL);
require_once(BIB_SMARTY);

require_once(FWK_UTIL."FormataCampos.class.php");
require_once(FWK_UTIL."Utf8Parsers.class.php");
require_once(FWK_UTIL."FormataDatas.class.php");
require_once(FWK_UTIL."HttpUtil.class.php");

require_once(FWK_EXCEPTION."CustonException.class.php");
require_once(BIB_FWK."adodb/adodb-errorpear.inc.php");

require_once(PASTA_FWK."tags.php");

//biblioteca de controle dos templates
$objCtrlSmarty = ControlSmarty::getSmarty();

//SESSAO
$objSessao = new ControlSessao();
$objUsrSession = $objSessao->getObjSessao(SESSAO_ADMIN);

//título da pagina
$objCtrlSmarty->assign("TITULO_PAG",TITULO_ADMIN);


//definição dos estilos do admin, se necessário acrescentar outro, apenas concatenar à string com \n no final.
$strCss = "";

$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/jquery.lightbox-0.5.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/ui-lightness/jquery-ui-1.8.18.custom.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/ui-themes/ui-lightness/jquery.ui.all.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/ui-themes/theme-default.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/facebox.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/estiloAdmin.css\" />\n";
$strCss .= "<link rel=\"stylesheet\" type=\"text/css\" href=\"../css/ui.colorpicker.css\" />\n";


$objCtrlSmarty->assign("CSS_SITE",$strCss);
$strJs = "";


$strJs .= "<script type=\"text/javascript\" src=\"../js/jquery.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/lightboxAdmin.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/ui/jquery.ui.core.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/ui/jquery.ui.widget.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/facebox.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/ui/jquery-ui-1.8.18.custom.js\"></script>\n";
$strJs .= "<script type=\"text/javascript\" src=\"../js/colorpicker.js\"></script>\n";



$strJs .= "<script type=\"text/javascript\" src=\"../js/acoesAdmin.js\"></script>\n";
$objCtrlSmarty->assign("JS_SITE",$strJs);



//Variáveis
$objCtrlSmarty->assign("TITULO",TITULO_SITE);

$objCtrlSmarty->assign("NOME_USUARIO",$objUsrSession->getNomeAdministrador());
$objCtrlSmarty->assign("DADO_ULTIMO_ACESSO",FormataDatas::getDataHora($objUsrSession->getUltimoAcesso()));

//define o cabeçaho do admin
$objCtrlSmarty->assign("CABECALHO",$objCtrlSmarty->fetch(TPLS_FILE."admin/adminCabecalho.tpl"));

//define o cabeçaho do admin
$objCtrlSmarty->assign("MENU_ADMIN",$objCtrlSmarty->fetch(TPLS_FILE."admin/adminMenu.tpl"));

//define o rodape do admin
$objCtrlSmarty->assign("RODAPE",$objCtrlSmarty->fetch(TPLS_FILE."admin/adminRodape.tpl"));

/**
 * Mensagens do sistema, adicionar aqui para o admin, para seguir o default no sistema
 */
if(isset($_GET["msg"])){
	switch($_GET["msg"]){
		case 3:
			$objCtrlSmarty->assign("LABEL_MENS_SIS",MSG_CADASTRO_SUCESSO);
			break;
		case 4:
			$objCtrlSmarty->assign("LABEL_MENS_SIS",MSG_EXCLUIDO_SUCESSO);
			break;
		case 5:
			$objCtrlSmarty->assign("LABEL_MENS_SIS",MSG_CADASTRO_ERRO);
			break;
		case 6:
			$objCtrlSmarty->assign("LABEL_MENS_SIS",MSG_FALECONOSCO_SUCESSO);
			break;
		case 7:
			$objCtrlSmarty->assign("LABEL_MENS_SIS",MSG_ERRO_EXCLUSAO);
	}
	$objCtrlSmarty->assign("MSG_SISTEMA",$objCtrlSmarty->fetch(TPLS_FILE."admin/adminMsg.tpl"));
}


function debug($arrDebug){
	print("<pre>");
	print_r($arrDebug);
	die();
}

$strParams = "&";
foreach ($_GET as $key => $value) {
	if($key !="" && $value != "")
	$strParams.= $key."=".$value."&";
}
$strParams = substr($strParams, 0, -1);
$objCtrlSmarty->assign("paramsPag",$strParams);

?>